package com.bocom.hairy.crab.web.controller;

import com.alibaba.cloud.nacos.annotation.NacosConfig;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName com.bocom.hairy.crab.web.controller.ConfigController <br/>
 * @Description: 配置中心获取配置     <br/>
 * @Author jiangshikun             <br/>
 * @Date 2025/9/3 上午9:36          <br/>
 * @Version V1.0
 * ----------------------------------------
 * （^-^）心即理，知行合--致良知 （^-^）
 * 邮 箱:duzhuai@live.cn
 * 地 址：北京市海淀区永澄北路2号
 **/
@Tag(name = "配置管理")
@RestController
@RequestMapping("/config")
public class ConfigController {

    @Value("${system.project.name:hairy-crabs}")
    private String systemName;


    //@Value("${plainKey}")
   // String testKey;


    public void setUseLocalCache(String systemName) {
        this.systemName = systemName;
    }

    //@NacosConfig(dataId = "crab-web.properties", group = "DEFAULT_GROUP", key = "system.project.name")
   // String rate;

    /*@Operation(summary = "testPlainKey")
    @RequestMapping("/testPlainKey")
    public String test() {
        return testKey;
    }
    @Operation(summary = "rate")
    @RequestMapping("/rate")
    public String rate() {
        return rate;
    }*/




    /**
     * 从配置中心获取配置
     * @return
     */
    @Operation(summary = "获取配置")
    @GetMapping(value = "/get")
    @ResponseBody
    public String get() {
        return systemName;
    }
}
